<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="/WEB-INF/tld/struts-bean" prefix="bean"%> 
<%@ taglib uri="/WEB-INF/tld/struts-html" prefix="html"%>
<%@ taglib uri="/WEB-INF/tld/struts-logic" prefix="logic" %>
<%@ taglib uri="/WEB-INF/tld/jstl/c" prefix="c" %>
<%@ taglib uri="/WEB-INF/tld/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="/WEB-INF/tld/jstl/fn" prefix="fn" %>
<%@ taglib uri="/WEB-INF/tld/FCKeditor" prefix="FCK" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html:html locale="true">
  <head>
    <html:base />
    
    <title>添加直播</title>

	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	<style type="text/css">
.vb_wid {width:100%; margin: 0 auto; border-top:1px #FDB18D solid; background:#F5F5F5; color:#FE6500; text-indent:20px; line-height:25px; font-size:12px;}
.fb_search {width:90%; margin:0 auto; margin-top:20px; border:1px #FFCD7F solid;}
.fb_search h1 {background:#FFEFBB; margin:0px; padding:0px; line-height:28px; text-indent:10px; font-size:14px;}
.fb_ddd {width:90%; margin:0 auto; margin-top:10px; border-top:3px #FFCC00 solid; background:url(images/pen.gif) no-repeat 5px 3px; height:40px; text-indent:50px; line-height:40px; color:#464646; font-size:12px;}
.fb_nr {width:90%; margin:0 auto; margin-top:10px; line-height:40px; font-size:12px; color:#464646}
.fb_nr span {color:#CCC;}
.fb_nr select {color:464646; font-size:12px;}
.fb_nr Div {margin-left:10px;}
.fb_nr .table11 {border-top:1px #FFCC66 solid; background:#FFF2D7;}
.fb_nr .table22 {border-top:1px #E1E1E1 solid; background:#F9F9F9; margin-left:10px;}
.fb_nr .table33 {border-top:1px #FFCC66 solid; border-bottom:1px #FFCC66 solid; background:#FFF2D7;}
.fb_nr .table44 {border-top:1px #E1E1E1 solid; border-bottom:1px #E1E1E1 solid; background:#F9F9F9; margin-left:10px;}
.inputtttt {border:1px #DEA303 solid; height:20px; color:#464646; font-size:12px; background:url(images/bottom_bg.jpg) repeat-x left top;}
</style>
<script type='text/javascript' src='/dwr/interface/homeSiteDWRServ.js'></script>
<script type='text/javascript' src='/dwr/engine.js'></script>
<script type='text/javascript' src='/dwr/util.js'></script>
<script type="text/javascript">
          function getDirectSeedNameMap(obj){
		     homeSiteDWRServ.loadDirectSeedNameMapByInputtime(obj.value,getAllDirectSeedNameMap);
	 	}
	    function getAllDirectSeedNameMap(data){
	    
	  	  var magazineNameid = document.getElementById("directSeedNameid");
	      DWRUtil.removeAllOptions(magazineNameid);
	      DWRUtil.addOptions(magazineNameid, {'-2':'选择直播名'}); 
	      DWRUtil.addOptions(magazineNameid, data); 
	    }

          function getDirectSeedClassMap(obj){
		     homeSiteDWRServ.loadByNameIdMap(obj.value,getAllgetDirectSeedClassMap);
	 	}
	    function getAllgetDirectSeedClassMap(data){
	    
	  	  var magazineClassid = document.getElementById("directSeedClassid");
	      DWRUtil.removeAllOptions(magazineClassid);
	      DWRUtil.addOptions(magazineClassid, {'-2':'请选择直播类别'}); 
	      DWRUtil.addOptions(magazineClassid, data); 
	    }
    function change(){
     var imgstr1=document.getElementById("imgstr1");
     var imgstr=document.getElementById("imgstr");
    for(var i=0;i<document.all.isimg.length;i++){
			 if(document.all.isimg[i].checked&&document.all.isimg[i].value=='0') {
			  		imgstr1.style.display="none";
			  		imgstr.disabled = true;
			  		
			 }
			 if(document.all.isimg[i].checked&&document.all.isimg[i].value=='1') {
			  		imgstr1.style.display="block";
			  		imgstr.disabled = false;
			  		
			 }
	}
  }
    function changetoptitle(){
     var jsStr=document.getElementById("jsStr");
     var js=document.getElementById("js");
    for(var i=0;i<document.all.toptitle.length;i++){
			 if(document.all.toptitle[i].checked&&document.all.toptitle[i].value=='0') {
			  		jsStr.style.display="none";
			  		js.disabled = true;
			  		
			 }
			 if(document.all.toptitle[i].checked&&document.all.toptitle[i].value=='1') {
			  		jsStr.style.display="block";
			  		js.disabled = false;
			  		
			 }
	}
  }


</script>
<script type="text/javascript">

 function check(){
  var title=document.getElementById('title').value;
  var source=document.getElementById('source').value;
  var directSeedClassid=document.getElementById('directSeedClassid').value;
  var keyword=document.getElementById('keyword').value;
  var writer=document.getElementById('writer').value;
  
  
     if(directSeedClassid==-2||directSeedClassid==null||directSeedClassid==''){
          alert('直播小分类不可以为空！！！');
          return false;
     }
     
     if(title==null||title==''){
          alert('直播标题不可以为空！！！');
          return false;
     }
      if(title.length>25){
          alert('直播标题不可以大于30个字符！！！');
          return false;
     }
     if(keyword==null||keyword==''){
          alert('关键字不可以为空！！！');
          return false;
     }
      if(keyword.length>25){
          alert('关键字不可以大于25个字符！！！');
          return false;
     }
     if(writer==null||writer==''){
          alert('作者不可以为空！！！');
          return false;
     }
      if(writer.length>25){
          alert('作者不可以大于25个字符！！！');
          return false;
     }
      if(source.length>25){
          alert('直播来源不可以大于25个字符！！！');
          return false;
     }
     
    for(var i=0;i<document.all.toptitle.length;i++){
  	if(document.all.toptitle[i].checked&&document.all.toptitle[i].value=='1') {
  	  var js=document.getElementById('js').value;
  	   if(js==null||js==""){
  	      alert('简介不可以为空！！！');
  	      return false;	  		
	 }
  
  }    
  }
   for(var i=0;i<document.all.isimg.length;i++){
  	if(document.all.isimg[i].checked&&document.all.isimg[i].value=='1') {
  	  var imgstr=document.getElementById('imgstr').value;
  	   if(imgstr==null||imgstr==""){
  	      alert('请上传图片！！！');
  	      return false;
  	   }
			  		
	 }
  
  }
    return true;
 }


</script>


  </head>
<body>
<logic:present name="add">
<bean:write name="add" filter="false"/>
</logic:present>
<div class="fb_ddd">添加直播</div>
<div class="fb_nr">
    <html:form action="/admin/directSeed.do?method=add" onsubmit="return check();" enctype="multipart/form-data">
     <table width="100%" border="0">
      <tr>
      <td width="17%" align="center" class="table11">直播分类:</td>
      <td width="83%" class="table22"><div><label>
     <select name="year" size="1" onchange="getDirectSeedNameMap(this);">
     <option value="-2">--选择年份--</option>
     <option value="2005" <c:if test="${year==2005}">selected</c:if>>2005年</option>
     <option value="2006" <c:if test="${year==2006}">selected</c:if>>2006年</option>
     <option value="2007" <c:if test="${year==2007}">selected</c:if>>2007年</option>
     <option value="2008" <c:if test="${year==2008}">selected</c:if>>2008年</option>
     <option value="2009" <c:if test="${year==2009}">selected</c:if>>2009年</option>
     <option value="2010" <c:if test="${year==2010}">selected</c:if>>2010年</option>
     </select>
    <html:select property="directSeedNameid" onchange="getDirectSeedClassMap(this);">
    <html:option value="-2" >请选择</html:option>
        <c:if test="${directSeedNamemap!=null}">
	      <html:optionsCollection name="directSeedNamemap" label="value" value="key"/>
	    </c:if>
    </html:select>-
    <html:select property="directSeedClassid">
    <html:option value="-2" >请选择</html:option>
    <c:if test="${directSeedClassMap!=null}">
    <logic:iterate id="list" name="directSeedClassMap">
    <option value="${list.key }" <c:if test="${directSeedClassid==list.key }">selected</c:if>>${list.value}</option>
    </logic:iterate>
    </c:if>
    
     </html:select>
     </label></div></td>
	</tr>
     
	 <tr>
      <td align="center" class="table11">直播标题:</td>
      <td class="table22"><div><label>
         <input type="text" name="title" class="cpxx_int" size="18" /><font color="red">*</font>
         </label></div></td>
       </tr>
	 <tr>
      <td align="center" class="table11">关 键 字:</td>
      <td class="table22"><div><label>
         <input type="text" name="keyword" class="cpxx_int" size="18" /><font color="red">*</font>
        <span>(多个关键字间用&quot;,&quot;逗号隔开)</span></label></div></td>
       </tr>
       

	 <tr>
      <td align="center" class="table11">直播作者:</td>
      <td class="table22"><div><label>
         <input type="text" name="writer" class="cpxx_int" size="18" /><font color="red">*</font>
         </label></div></td>
       </tr>
	 <tr>
      <td align="center" class="table33">直播来源:</td>
      <td class="table44"><div><label>
         <input type="text" name="source" class="cpxx_int" size="18" /><font color="red">*</font>
          </label></div></td>
       </tr>
       <tr>
       <td align="center" class="table33">是否推荐：</td>
      <td class="table44"><div><label>
          <input type="radio" name="iscommend" value="0" checked />否 
          <input type="radio" name="iscommend" value="1" />是</label></div></td>
       </tr>
       <tr>
      <td align="center" class="table11">是否头条:</td>
      <td class="table22"><div><label>
         	<input type="radio" name="toptitle" value="0" onclick="changetoptitle();"  checked />否
			<input type="radio" name="toptitle" value="1" onclick="changetoptitle();" />是</label></div></td>
       </tr>
       <tr id="jsStr" style="display:none;">
      <td align="center" class="table11">头条简介:</td>
      <td class="table22"><div><label>
      <textarea rows="4" cols="50" name="js"></textarea>
			</label></div></td>
       </tr>
       <tr>
      <td align="center" class="table11">图片：</td>
      <td class="table22"><div><label>
            <input type="radio"  name="isimg" value="0" onclick="change();" checked />否
			<input type="radio"  name="isimg" value="1" onclick="change();" />是
         </label></div></td>
       </tr>
       <tr id="imgstr1" style="display:none;">
        <td align="center" class="table11">图片：</td>
        <td class="table22"><div><label>
         <input type="file" name="imgstr" />
         </label></div></td>
       </tr>
       <tr>  
        <td align="center" class="table11">直播内容：</td>
        <td class="table22"><div><label></label></div></td>
	</tr>
					    
	 <tr>
		<td colspan="2">
			<FCK:editor 
			id="content" 
			basePath="/FCKeditor/" 
			width="609" 
			height="593" 
			skinPath="/FCKeditor/editor/skins/silver/" 
			toolbarSet = "Basic">
			</FCK:editor> 
	   </td>
	 </tr>  
       
       
	   <tr>
         <td></td>
         <td><label>
           <input type="submit" name="Submit" value="提交" class="cpxx_int1" />
           <input type="reset" name="Submit2" value="重置" class="cpxx_int1" />
         </label>
         
         </td>
       </tr>
     </table>
         </html:form>
   <h1><img src="image/qqddc_shop1.gif" width="720" height="8" /></h1>
</div>
</body>
</html:html>
